package com.concurrent.sample.business.dto.trade;

import com.concurrent.sample.business.consts.enums.EventTypeEnum;
import com.concurrent.sample.business.consts.enums.SideEnum;
import com.concurrent.sample.business.dto.report.TradeExecReportDTO;
import com.concurrent.sample.business.entity.EventEntity;
import com.concurrent.sample.business.entity.OrderEntity;
import java.util.Optional;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class TradeExecReportParamParam implements BaseTradeEventParam {

  private EventEntity event;

  private OrderEntity order;

  private TradeExecReportDTO execReport;

  @Override
  public EventTypeEnum getEventType() {
    return Optional.ofNullable(event).map(EventEntity::getEventType).orElse(null);
  }

  @Override
  public SideEnum getSide() {
    return Optional.ofNullable(event).map(EventEntity::getSide).orElse(null);
  }

}
